package net.jsoft.pms.repository.openservice;

import java.util.List;

import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.transaction.annotation.Transactional;

import net.jsoft.pms.entity.openservice.OpenService;
import net.jsoft.pms.entity.ywfwqd.YwfwqdEntity;

@Transactional
public interface OpenServiceRepository extends JpaSpecificationExecutor<OpenService>, PagingAndSortingRepository<OpenService, Long>
{

    @Query("from OpenService ")
    List<OpenService> findAllOpenService();

//    @Query(value = "select * from t_dzswj_ywfwqdb where  requestxsd is not null and responsexsd is not null and  dwfbzt in(0,1,2,3,4,5,6)  order by sszb  desc", nativeQuery = true)
//    List<PublishService> findAllYwfwqd();

    @Query(value = "from YwfwqdEntity  where  requestxsd is not NULL and responsexsd is not null and  dwfbzt  IN( 1, 3,4 ) order by sszb desc ")
    List<YwfwqdEntity> findPublishedYwfwqd();

    @Query(value = "from YwfwqdEntity where  requestxsd is not NULL and responsexsd is not null and  dwfbzt  IN( 3,4,5 ) order by sszb desc  ")
    List<YwfwqdEntity> findAddtionYwfwqd();

//    @Query(value = "from PublishService where  openService.id = :id and type = '1' ")
//    List<PublishService> findAllPSByOSId(@Param("id") long id);
//
//    @Query(value = "from PublishService where  openService.id = :id and type = '0' ")
//    List<PublishService> findAddPSByOSId(@Param("id") long id);

    //    @Modifying
    //    @Query("delete from  PublishService where  openService.id = :id")
    //    void deletePSByOSId(@Param("id") long id);

}
